<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="../base.jsp"%>
<!DOCTYPE html>
<html>

<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>数据 - AdminLTE2定制版</title>
    <meta name="description" content="AdminLTE2定制版">
    <meta name="keywords" content="AdminLTE2定制版">
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
    <!-- 页面meta /-->
</head>
<body>
<div id="frameContent" class="content-wrapper" style="margin-left:0px;">
    <section class="content-header">
        <h1>
            统计分析
            <small>单价排行</small>
        </h1>
    </section>
    <section class="content">
        <div class="box box-primary">
            <div id="main" style="width: 900px;height:500px;"></div>
        </div>
    </section>
</div>
</body>
<script src="../plugins/jQuery/jquery-2.2.3.min.js"></script>
<script src="../../plugins/echarts/echarts.min.js"></script>
<script type="text/javascript">

    $.get("/stat/findCargoData.do",function (data) {
        //处理数据格式
        var titles = [];//x轴数据
        var price = []; //y轴数据
        for (var i = 0; i<data.length; i++){
            var obj = data[i];
            titles[i] = obj.productNo;
            price[i] = obj.price;
        }

    //1.初始化echarts实例(定义图形展示的位置)
    var myChart = echarts.init(document.getElementById('main'));


    option = {
        xAxis: {
            type: 'category',
            data: titles,
            axisLabel: {
                rotate:45
            }
        },
        yAxis: {
            type: 'value'
        },
        series: [{
            data: price,
            type: 'bar'
        }]
    };


    //3.使用配置生成图形
    myChart.setOption(option);
    })
</script>

</html>